<script type="text/javascript">
var enable_submit = true;

function submit_sysconfig_update() {
    var sysconfig_value = $("#sysconfig_update_modal").find("#sysconfig_value_cr");
    var bValid = true;
    if (bValid) {
        if (enable_submit) {
            enable_submit = false;
            var $submitBtn = $('.modal-footer').find('.btn-blue');
            $submitBtn.html('<i class="fa fa-spinner fa-spin" style="margin:3px 6px;"></i>');
            $('.rtn-tip').slideUp('fast');
            $.post("/sysconfig_update", {
                    "value": sysconfig_value.val(),
                    "id": "{{ sysconfig.id }}"
                },
                function(data) {
                    if (data.reply.is_success) {
                        angular.element('#sysconfig_controller').scope().close();
                        $('#sysconfig_table').trigger("reloadGrid")
                    } else {
                        error = data.reply.error;
                        $('.rtn-tip').text(error).slideDown('fast');
                        $submitBtn.html(SelfTranslate("[[ 'label ok'|translate ]]"));
                        enable_submit = true;
                    }
                });
        }
    }
}
</script>
<div class="modal-header">
    <h3>编辑</h3>
</div>
<div class="modal-body modal-body-height" id="sysconfig_update_modal">
    <div class="sysconfig-update-box">
        <div class="rtn-tip"></div>
        <table class="base-info">
            <tr>
                <td>
                    <label>模块</label><a>*</a>
                </td>
                <td colspan="3">
                    <label><b>{{sysconfig.module}}</b></label>
                </td>
            </tr>
            <tr>
                <td>
                    <label>键</label><a>*</a>
                </td>
                <td>
                    <label><b>{{sysconfig.key}}</b></label>
                </td>
                <td style="width: 12.5%;text-align: left;">
                    <label>值</label><a>*</a>
                </td>
                <td style="width: 37.5%;">
                    <input id="sysconfig_value_cr" size="25" type="text" value="{{sysconfig.value}}" />
                </td>
            </tr>
        </table>
    </div>
</div>
<div class="modal-footer">
    <button class="btn btn-blue" ng-click="update()">[[ 'label ok'|translate ]]</button>
    <button class="btn btn-white" ng-click="cancel()">[[ 'label cancel'|translate ]]</button>
</div>
